local zeyue = fk.CreateSkill({
  name = "pc__zeyue",
})

zeyue:addEffect(fk.Damaged, {
  anim_type = "support",
  prompt = "将一名其他角色的一张牌移出游戏或分配游戏外的一张“<b>迮阅</b>”牌",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(zeyue.name)
  end,
  trigger_times = function (self, event, target, player, data)
    return data.damage
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local targets = table.filter(room.alive_players, function(p)
        return player ~= p and p:getCardIds("h")~=0
    end)
    local to = room:askToChoosePlayers(player, {
        targets = targets,
        min_num = 0,
        max_num = 1,
        prompt = "将一名其他角色的一张牌移出游戏，取消则分配一张“迮阅”牌",
        skill_name = zeyue.name,
    })
    if #to ~= 0 then
      local card = room:askToChooseCard(player, {
      target = to[1],
      flag = "he",
      skill_name = zeyue.name,
      prompt = "将其一张牌移出游戏",
      })
      player:addToPile(zeyue.name, card, true, zeyue.name, player)
    elseif #player:getPile(zeyue.name) > 0 then
      local card = room:askToCards(player, {
      min_num = 1,
      max_num = 1,
      include_equip = false,
      pattern = "",
      prompt = "分配其中一张牌",
      skill_name = zeyue.name,
      expand_pile = zeyue.name,
      })
      if #card~=0 then
        local tos = room:askToChoosePlayers(player, {
          targets = room.alive_players,
          min_num = 1,
          max_num = 1,
          prompt = "将此牌交给一名角色",
          skill_name = zeyue.name,
        })
        room:moveCardTo(card, Card.PlayerHand, tos[1], fk.ReasonGive, zeyue.name, nil, false, player)
      end
      
    end
  end,
})



Fk:loadTranslationTable {
["pc__zeyue"] = "迮阅",
[":pc__zeyue"] = "当你受到1点伤害后，你可以将一名其他角色的一张牌移出游戏或分配游戏外的一张“<b>迮阅</b>”牌。",
["$pc__zeyue1"] = "以令相责，树阀阅之家。",
["$pc__zeyue2"] = "以证相争，清朝野之妒。",
}
return zeyue